package com.zhiying.crawler.dao;

import com.zhiying.crawler.dto.SortDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface SortDao {

    Integer saveSortInfo(List<SortDTO> sortList);

    @Update("update sort set sort_page=#{sort.sortPage} ,status=#{sort.status,jdbcType=CHAR,javaType=Boolean,typeHandler=com.zhiying.crawler.dao.BooleanTypeHandler}  " +
            "where sort_link=#{sort.sortLink}")
    Integer updateSortInfo(@Param("sort") SortDTO sort);

    @Select("select * from sort where status='N'")
    List<SortDTO> getSortList();

    @Select("select * from sort where sort_link=#{sortLink} and status='Y'")
    Integer getAlreadyClimbed(@Param("sortLink") String sortLink);
}
